home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
MPW_C
/
NEWLINEM.C
next >
Wrap
Text File
|
1992-06-11
|
1KB
|
29 lines
In article <92111.112015U21192@uicvm.uic.edu>, U21192@uicvm.uic.edu (John Galidakis) writes:
> IM IV states that the file manager has the capability to read consequtive
> bytes from files in the so called "newline mode" where a sentinel
> (usually a CR) is used to terminate the Read. (page 95)
> However I can't find any references on how this is done.
I used newline mode in a DA I wrote a couple of years ago; here's the
relevant section of code:
/*
* Here we use "newline mode", meaning that all read operations will
* terminate at a newline character. We select newline mode by setting
* bit 7 of ioPosMode and specifying the newline character (here, the
* ASCII CR (0D hex)) in the high-order byte of ioPosMode (leading to
* the "0x0D80" below)
*/
pb.ioRefNum = refNum;
pb.ioBuffer = (Ptr) str + 1;
pb.ioReqCount = sizeof(Str255) - 1;
pb.ioPosMode = fsAtMark | 0x0D80; /* set newline mode */
err = PBReadSync(&pb);
See the note on IM IV-121 for the complete story.
Chris Wysocki
wysocki@husc.harvard.edu